package org.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.domain.Book;
import org.example.domain.BookContent;
import org.example.domain.QuestionContent;

import java.util.List;

@Mapper
public interface BookContentDao extends BaseMapper<BookContent> {
    @Delete("delete from book_content where book_id=#{bookId}")
    int deleteBookContentByBookId(Integer bookId);

    @Select("select count(*) from book_content where book_id = #{bookId}")
    int selectByBookId(Integer bookId);

    @Update("update book_content set description=#{description},catalog=#{catalog},content=#{content} where book_id=#{bookId}")
    int updateByBookId(BookContent bookContent);

//    List<String> setBookContent(@Param("id") int id, @Param("description") List<String> description,@Param("catalog") List<String> catalog,@Param("content") List<String> content);

    @Insert("insert into book_content(book_id,description,catalog,content) values(#{bookId},#{description},#{catalog},#{content})")
    int ContentInsert(BookContent bookContent);

    @Select("select * from book_content where book_id =#{bookId}")
    BookContent getContentByBookId(int bookId);

    @Select("select * from book_content where book_id = #{bookId}")
    BookContent selectByBookId1(Integer bookId);

    @Select("select count(*) from book_content where book_id = #{bookId}")
    List<Integer> selectByBookId2(List<Integer> bookId);


//    @Select("select count(*) from book_content where where ")
}
